/**
 * Copyright © 2013 Creativor Studio.
 * About license information, please see LICENSE.txt.
 */
package org.rayson.share.http;

import java.util.Map;

import org.rayson.api.annotation.NotNull;
import org.rayson.share.transport.BufferWritable;

/**
 * Stands for an message of HTTP protocol.
 * 
 * @author creativor
 */
public interface HttpMessage extends BufferWritable {
	public void addHeader(HttpHeader header);

	/**
	 * Message body of this message.
	 * 
	 * @return Message body byte array. If no any content,an empty array return.
	 */
	public byte[] getBody();

	public int getBodyLength();

	/**
	 * Get an header by giving name.
	 * 
	 * @param name
	 *            Header name.
	 * @return Found header. Or <code>null</code> if no matched header.
	 */
	public HttpHeader getHeader(@NotNull String name);

	/**
	 * @return Headers object of this message.
	 */
	public abstract Map<String, HttpHeader> getHeaders();

	/**
	 * Start line of this message.
	 */
	public HttpStartLine getStartLine();

}
